package com.hao.wms.dao.impl;

import com.hao.wms.dao.IProductStockDao;
import com.hao.wms.domain.ProductStock;
import org.hibernate.Session;

public class ProductStockDaoImpl extends GenericDaoImpl<ProductStock> implements IProductStockDao {
    @Override
    public ProductStock getByDepotAndProduct(Long depotId, Long productId) {
        Session session = sessionFactory.getCurrentSession();
        return (ProductStock) session
                .createQuery("select obj from ProductStock obj where obj.depot.id=? and obj.product.id=?")
                .setParameter(0, depotId).setParameter(1, productId).uniqueResult();
    }
}
